﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Anyask
{
    public partial class login : Form
    {
        public login()
        {
            InitializeComponent();
        }

        private void login_Load(object sender, EventArgs e)
        {
            this.MaximizeBox = false;
        }

        private void ButtonLogin_Click(object sender, EventArgs e)
        {
            tryLogin();
        }

        private void login_Shown(object sender, EventArgs e)
        {
            this.Hide(); Form form = new room(); form.Owner = this; form.Show();
        }

        private void tryLogin()
        {
            if (this.InputNickname.Text.Length > 0 && this.InputPassword.Text.Length > 0)
            {
                this.Hide();
                Form form = new room();
                form.Owner = this;
                form.Show();
            }
        }

        private void login_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                tryLogin();
                e.SuppressKeyPress = true;
            }
        }
    }
}
